namespace Example
{
    using System.Net;
    using SimpleWebServices.Net;
    using SimpleWebServices.Web;
    using SimpleWebServices.Web.UI.Html.Elements;
    using Xunit;

    public sealed class ExceptionFacts
    {
        private static readonly Resource _resource = new GenericResource
        {
            Title = "Sorry, an unexpected error was encountered",
            Metadata =
            {
                new Meta { Name = "robots", Content = "NOFOLLOW,NOINDEX" }
            }
        }
        .ApplyDefaultValues<GenericResource>();

        [Fact]
        public void Get_HtmlRepresentation()
        {
            /// if this test fails, go check if <customErrors mode="Off"/> in web.config
            Assert.True(HttpExpectations.New("http://example.simplewebservices.org/exception")
                .AcceptAnyContent()
                .AcceptAnyLanguage()
                .Cookieless()
                .Get()
                .Is(HttpStatusCode.InternalServerError)
                .HasCacheControlNone()
                .HasContentLanguageOfEnglish()
                .HasContentMD5()
                .ResponseIsTextHtml(_resource)
                .HasRobotsTag("NOFOLLOW,NOINDEX")
                .Evaluate<double>(1, Analytics.Xpath)
                .HasNoCookies()
                .Result);
        }
    }
}